package com.Algorithm.HUAWEI.one20211020;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/27/10:56
 * @Description:
 * @Target:
 */
public class 质数因子 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int num1 = 0;
        for (int i = 1; i <= (int)Math.sqrt(n); i++) {
            if (n%i==0&&isZhiShu(i)){
              num1 = i;
              break;
            }else if (i==(int)Math.sqrt(n)){
                num1 = n;
            }
        }

        while (n>1&&num1>0){
          System.out.print(num1+" ");
           n =  n/num1;
           if (isZhiShu(n)){
               System.out.print(n+" ");
               n=0;
           }else {
               for (int i = 1; i <= (int)Math.sqrt(n); i++) {
                   if (n%i==0&&isZhiShu(i)){
                       num1 = i;
                       break;
                   }else if (i==(int)Math.sqrt(n)){
                       num1 = n;
                   }
               }
           }

        }


    }

    // 质数
    static boolean isZhiShu(int n){
        boolean flag= true;
        if (n==1||n==0){
            flag = false;
        }
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (n%i==0){
                flag = false;
            }
        }

        if (n==2){
            flag = true;
        }

        return flag;
    }
}
